package test3_20.demo06;

public class Farmer {
    public void Feed(Animal animal){
        System.out.println("农民开始喂动物");
        if (animal instanceof Cow){
            Animal a = new Cow();
            a.eat();
        }else if(animal instanceof Horse){
            Animal a = new Horse();
            a.eat();
        }else if(animal instanceof Sheep) {
            Animal a = new Sheep();
            a.eat();
        }
    }
}
